Skip to main content

SuperPool Lens

Overview

The SuperPoolLens is a helper contract with view-only functions that help fetch SuperPool metrics, BasePool metrics, and data for assets deposited by users in the SuperPool.

State Variables

POOL

Address to the protocol's pool instance

Pool public immutable POOL;

RISK_ENGINE

Address to the protocol's risk engine instance

RiskEngine public immutable RISK_ENGINE;

Functions

constructor

constructor(address pool, address riskEngine);

Parameters

NameTypeDescription
pooladdressAddress to the protocol's pool instance
riskEngineaddressAddress to the protocol's risk engine instance

getSuperPoolData

Fetch current state for a given SuperPool

function getSuperPoolData(address _superPool) external view returns (SuperPoolData memory superPoolData);

Parameters

NameTypeDescription
_superPooladdressAddress of the super pool

Returns

NameTypeDescription
superPoolDataSuperPoolDataComprehensive current state data for the given super pool

getPoolDepositData

Fetch data for SuperPool deposits in a given pool

function getPoolDepositData(
address superPool,
uint256 poolId
) public view returns (PoolDepositData memory poolDepositData);

Parameters

NameTypeDescription
superPooladdressAddress of the super pool
poolIduint256Id for the underlying pool

Returns

NameTypeDescription
poolDepositDataPoolDepositDataCurrent data for deposits to poolId from the superPool

getUserMultiDepositData

Fetch the current data for a given user's deposits across multiple super pools

function getUserMultiDepositData(
address user,
address[] calldata superPools
) public view returns (UserMultiDepositData memory userMultiDepositData);

Parameters

NameTypeDescription
useraddressAddress of the user
superPoolsaddress[]List of SuperPool addresses to fetch data

Returns

NameTypeDescription
userMultiDepositDataUserMultiDepositDataCurrent deposit data for user across each super pool

getUserDepositData

Fetch a particular user's deposit data for a given super pool

function getUserDepositData(
address user,
address _superPool
) public view returns (UserDepositData memory userDepositData);

Parameters

NameTypeDescription
useraddressAddress of the user
_superPooladdressAddress of the superPool

Returns

NameTypeDescription
userDepositDataUserDepositDataCurrent user deposit data for the given super pool

getPoolInterestRate

Fetch current borrow interest rate for a given pool

function getPoolInterestRate(uint256 poolId) public view returns (uint256 interestRate);

Parameters

NameTypeDescription
poolIduint256Id of the underlying pool

Returns

NameTypeDescription
interestRateuint256current interest rate for the given pool

getSuperPoolInterestRate

Fetch the weighted interest yield for a given super pool

function getSuperPoolInterestRate(address _superPool) public view returns (uint256 interestRate);

Parameters

NameTypeDescription
_superPooladdressAddress of the super pool

Returns

NameTypeDescription
interestRateuint256current weighted interest yield for the given super pool

Structs

SuperPoolData

Comprehensive data container for SuperPool state including individual pool deposits and aggregate data

struct SuperPoolData {
string name;
address asset;
uint256 idleAssets;
uint256 totalAssets;
uint256 valueInEth;
uint256 interestRate;
PoolDepositData[] deposits;
}

PoolDepositData

Generic data container for SuperPool deposits associated with a particular pool

struct PoolDepositData {
address asset;
uint256 poolId;
uint256 amount;
uint256 valueInEth;
uint256 interestRate;
}

UserMultiDepositData

Container for a user's deposits across multiple super pools

struct UserMultiDepositData {
address owner;
uint256 interestRate;
uint256 totalValueInEth;
UserDepositData[] deposits;
}

UserDepositData

Container for a user's deposit in a single SuperPool

struct UserDepositData {
address owner;
address asset;
address superPool;
uint256 amount;
uint256 valueInEth;
uint256 interestRate;
}